<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:include href="menu.xsl" />
<xsl:include href="footer.xsl" />
<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" method="xml" encoding="iso-8859-1" />
  <xsl:template match="/">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
  <head>
  <title>Framework Inovia</title>
	<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
	<link rel="stylesheet" href="public/manager/css/manager.css" type="text/css" media="screen" />
  <script type="text/javascript" src="public/manager/js/alias.js"></script>
  <script type="text/javascript" src="public/manager/js/scaffold.js"></script>
  <script type="text/javascript" src="public/manager/js/menu.js"></script>
  
  </head>
  <body>
    <div id="header">
    	<img id="logo" src="public/manager/images/bando.png" alt="Fw-BofF" />  
    </div>
    <div id="date">
      <xsl:value-of select=".//site/date" />
    </div>
    
    <!--<ul id="menu">
    	<li><a href="index.php?action=homeManager">Home</a></li>
    	<li><a href="index.php?action=homeUsers">Users</a></li>
    	<li><a href="index.php?action=homeMonitoring">Monitoring</a></li>
    	<li><a class="active" href="index.php?action=homeScaffolding">Scaffolding</a></li>
    	<li><a href="index.php?action=homeUpdates">Updates</a></li>
    </ul>-->
    <xsl:call-template name="displayMenu">
      <xsl:with-param name="selectedMenu" select="string('admin')"/>
    </xsl:call-template>
    
    
    <div id="PageLeft">
    
      <div id="content">
        <h1 id="pageName">   Create scaffolding   </h1>

        <xsl:variable name="nbError" select="count(//error)" />
    		<xsl:if test="$nbError!=0">
          <p style="color:red">
          Errors found :<br />
      		  <xsl:for-each select="//error">
          		  - <xsl:value-of select="text" /><br/>
            </xsl:for-each>
           </p>
        </xsl:if>
        <p>
        <b><xsl:for-each select="//scaffInfo/result">
          - <xsl:value-of select="text()" /><br/>
        </xsl:for-each></b>
         </p>
        <p>
        	<xsl:value-of select="//site/dispatcherComment"></xsl:value-of>
        </p>
        <p>
        <b><xsl:for-each select="//scaffDispatcher/result">
          <xsl:value-of select="text()" />,<br/>
        </xsl:for-each></b>
        </p>

        <div style="margin:10px 0 0 20px;width:420px;padding:5px;border:1px dotted #AAAAAA;background-color:#ECF3E1;">
        <form method="post" action="index.php?action=scaffolding">
          <h2>Table name</h2>
    		  <p>
          <xsl:choose>
            <xsl:when test="//scaffolding/scaff_table/text()">
              <input type="text" value="{//scaffolding/scaff_table/text()}" name="scaff_table" id="scaff_table" onblur="scaffold_genericName()" />
            </xsl:when>
            <xsl:otherwise>
              <input type="text" value="" name="scaff_table" id="scaff_table" onblur="scaffold_genericName()" />
            </xsl:otherwise>
          </xsl:choose>
          </p>

    		  <h2>Generic name (singular name preferably)</h2>
    		  <p>
          <xsl:choose>
            <xsl:when test="//scaffolding/scaff_generic/text()">
              <input type="text" value="{//scaffolding/scaff_generic/text()}" name="scaff_generic" id="scaff_generic" />
            </xsl:when>
            <xsl:otherwise>
              <input type="text" value="" name="scaff_generic" id="scaff_generic" />
            </xsl:otherwise>
          </xsl:choose>
          </p>

    		  <h2>Prefix generated files with</h2>
    		  <p><small>(can be empty if 'Generic name' is not equal to 'Table name')</small><br />
          <xsl:choose>
            <xsl:when test="//scaffolding/scaff_prefix/text()">
              <input type="text" value="{//scaffolding/scaff_prefix/text()}" name="scaff_prefix" id="scaff_prefix" />
            </xsl:when>
            <xsl:otherwise>
              <input type="text" value="scaffold" name="scaff_prefix" id="scaff_prefix" />
            </xsl:otherwise>
          </xsl:choose>
           (example : scaffold_getArticle.php)
          </p>
    		  
          <h2>Directories</h2>
    		  <p><small>(can be empty)</small><br />
          Model classes directory : models/
          <xsl:choose>
            <xsl:when test="//scaffolding/scaff_modelDir/text()">
              <input type="text" value="{//scaffolding/scaff_modelDir/text()}" name="scaff_modelDir" id="scaff_modelDir" />/
            </xsl:when>
            <xsl:otherwise>
              <input type="text" value="" name="scaff_modelDir" id="scaff_modelDir" />
            </xsl:otherwise>
          </xsl:choose>
          Controler classes directory : controllers/
          <xsl:choose>
            <xsl:when test="//scaffolding/scaff_modelDir/text()">
              <input type="text" value="{//scaffolding/scaff_controlerDir/text()}" name="scaff_controlerDir" id="scaff_controlerDir" />/
            </xsl:when>
            <xsl:otherwise>
              <input type="text" value="" name="scaff_controlerDir" id="scaff_controlerDir" />
            </xsl:otherwise>
          </xsl:choose>
          Views directory : views/
          <xsl:choose>
            <xsl:when test="//scaffolding/scaff_viewDir/text()">
              <input type="text" value="{//scaffolding/scaff_viewDir/text()}" name="scaff_viewDir" id="scaff_viewDir" />/
            </xsl:when>
            <xsl:otherwise>
              <input type="text" value="" name="scaff_viewDir" id="scaff_viewDir" />
            </xsl:otherwise>
          </xsl:choose>
          </p>
          
          <h2>Generic actions allowed</h2>
          <p><small>(select at least one action)</small><br />
          <table border="0">
          <tr>
          
          <td>
            <xsl:choose>
              <xsl:when test="//scaffolding/scaff_get/text() = 'on'">
                <input type="checkbox" name="scaff_get" id="scaff_get" checked="checked" />
              </xsl:when>
              <xsl:otherwise>
                <input type="checkbox" name="scaff_get" id="scaff_get" />
              </xsl:otherwise>
            </xsl:choose>
            <label for="scaff_get"> Get</label>
          </td>
          
          <td></td>

          </tr>
          <tr>

          <td>
            <xsl:choose>
              <xsl:when test="//scaffolding/scaff_add/text() = 'on'">
                <input type="checkbox" name="scaff_add" id="scaff_add" checked="checked" />
              </xsl:when>
              <xsl:otherwise>
                <input type="checkbox" name="scaff_add" id="scaff_add" />
              </xsl:otherwise>
            </xsl:choose>
            <label for="scaff_add"> Add</label>
          </td>
          <td>
            + Form :
            <xsl:choose>
              <xsl:when test="//scaffolding/scaff_addForm/text() = 'xsl'">
                <input type="radio" value="none" name="scaff_addForm" id="scaff_addForm1" /><label for="scaff_addForm1">None</label> -
                <input type="radio" value="xsl" name="scaff_addForm" id="scaff_addForm2" checked="checked" /><label for="scaff_addForm2">Xsl</label> -
                <!--<input type="radio" value="flex" name="scaff_addForm" id="scaff_addForm3" /><label for="scaff_addForm3">Flex</label>-->
              </xsl:when>
              <xsl:when test="//scaffolding/scaff_addForm/text() = 'flex'">
                <input type="radio" value="none" name="scaff_addForm" id="scaff_addForm1" /><label for="scaff_addForm1">None</label> -
                <input type="radio" value="xsl" name="scaff_addForm" id="scaff_addForm2" /><label for="scaff_addForm2">Xsl</label> -
                <!--<input type="radio" value="flex" name="scaff_addForm" id="scaff_addForm3" checked="checked" /><label for="scaff_addForm3">Flex</label>-->
              </xsl:when>
              <xsl:otherwise>
                <input type="radio" value="none" name="scaff_addForm" id="scaff_addForm1" checked="checked" /><label for="scaff_addForm1">None</label> -
                <input type="radio" value="xsl" name="scaff_addForm" id="scaff_addForm2" /><label for="scaff_addForm2">Xsl</label> -
                <!--<input type="radio" value="flex" name="scaff_addForm" id="scaff_addForm3" /><label for="scaff_addForm3">Flex</label>-->
              </xsl:otherwise>
            </xsl:choose>
         </td>

          </tr>
          <tr>

          <td>
            <xsl:choose>
              <xsl:when test="//scaffolding/scaff_update/text() = 'on'">
                <input type="checkbox" name="scaff_update" id="scaff_update" checked="checked" />
              </xsl:when>
              <xsl:otherwise>
                <input type="checkbox" name="scaff_update" id="scaff_update" />
              </xsl:otherwise>
            </xsl:choose>
            <label for="scaff_update"> Update</label>
          </td>
          <td>
            + Form :
            <xsl:choose>
              <xsl:when test="//scaffolding/scaff_updateForm/text() = 'xsl'">
                <input type="radio" value="none" name="scaff_updateForm" id="scaff_updateForm1" /><label for="scaff_updateForm1">None</label> -
                <input type="radio" value="xsl" name="scaff_updateForm" id="scaff_updateForm2" checked="checked" /><label for="scaff_updateForm2">Xsl</label> -
                <!--<input type="radio" value="flex" name="scaff_updateForm" id="scaff_updateForm3" /><label for="scaff_updateForm3">Flex</label>-->
              </xsl:when>
              <xsl:when test="//scaffolding/scaff_updateForm/text() = 'flex'">
                <input type="radio" value="none" name="scaff_updateForm" id="scaff_updateForm1" /><label for="scaff_updateForm1">None</label> -
                <input type="radio" value="xsl" name="scaff_updateForm" id="scaff_updateForm2" /><label for="scaff_updateForm2">Xsl</label> -
                <!--<input type="radio" value="flex" name="scaff_updateForm" id="scaff_updateForm3" checked="checked" /><label for="scaff_updateForm3">Flex</label>-->
              </xsl:when>
              <xsl:otherwise>
                <input type="radio" value="none" name="scaff_updateForm" id="scaff_updateForm1" checked="checked" /><label for="scaff_updateForm1">None</label> -
                <input type="radio" value="xsl" name="scaff_updateForm" id="scaff_updateForm2" /><label for="scaff_updateForm2">Xsl</label> -
                <!--<input type="radio" value="flex" name="scaff_updateForm" id="scaff_updateForm3" /><label for="scaff_updateForm3">Flex</label>-->
              </xsl:otherwise>
            </xsl:choose>
         </td>

          </tr>
          <tr>

          <td>
            <xsl:choose>
              <xsl:when test="//scaffolding/scaff_delete/text() = 'on'">
                <input type="checkbox" name="scaff_delete" id="scaff_delete" checked="checked" />
              </xsl:when>
              <xsl:otherwise>
                <input type="checkbox" name="scaff_delete" id="scaff_delete" />
              </xsl:otherwise>
            </xsl:choose>
            <label for="scaff_delete"> Delete</label>
          </td>

          <td></td>

          </tr>
          </table>
          </p>
          


          <h2>Generate files</h2>
          <p>
            <input type="checkbox" name="scaff_overwrite" id="scaff_overwrite" /><label for="scaff_overwrite"> Check to overwrite files if they already exist</label><br />
            <input type="submit" value="Generate" />
          </p>
        </form>
  		  </div>
      </div>

    </div>
   <xsl:call-template name="displayFooter" />
  </body>
</html>
 </xsl:template>
 </xsl:stylesheet>
